pm: don't truncate processors' ACPI IDs to 8 bits
authorJan Beulich <jbeulich@novell.com>
Mon, 22 Aug 2011 09:10:39 +0000 (10:10 +0100)
committerJan Beulich <jbeulich@novell.com>
Mon, 22 Aug 2011 09:10:39 +0000 (10:10 +0100)
This is just another adjustment to allow systems with very many CPUs
(or unusual ACPI IDs) to be properly power-managed.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/ia64/linux-xen/acpi.c
xen/arch/x86/acpi/cpu_idle.c
xen/include/acpi/cpufreq/processor_perf.h

index fa3cf47ad7a2bea72f944d21386a7abd624fd662..995122d25e174889ee571eea428e6bdaac81e5af 100644 (file)
@@ -221,11 +221,14 @@ static u16 ia64_acpiid_to_sapicid[ MAX_LOCAL_SAPIC ] =
                {[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
 
 /* acpi id to cpu id */
-int get_cpu_id(u8 acpi_id)
+int get_cpu_id(u32 acpi_id)
 {
        int i;
        u16 apic_id;
 
+       if ( acpi_id >= MAX_LOCAL_SAPIC )
+               return -EINVAL;
+
        apic_id = ia64_acpiid_to_sapicid[acpi_id];
        if ( apic_id == 0xffff )
                return -EINVAL;
index b4c7df0e9a05774bd985d7139969895fada860e3..048dd60d99685e0a1a18243d4be611284486bc47 100644 (file)
@@ -895,11 +895,14 @@ static void set_cx(
         acpi_power->safe_state = cx;
 }
 
-int get_cpu_id(u8 acpi_id)
+int get_cpu_id(u32 acpi_id)
 {
     int i;
     u32 apic_id;
 
+    if ( acpi_id >= MAX_MADT_ENTRIES )
+        return -1;
+
     apic_id = x86_acpiid_to_apicid[acpi_id];
     if ( apic_id == BAD_APICID )
         return -1;
@@ -976,7 +979,7 @@ long set_cx_pminfo(uint32_t cpu, struct xen_processor_power *power)
     print_cx_pminfo(cpu, power);
 
     /* map from acpi_id to cpu_id */
-    cpu_id = get_cpu_id((u8)cpu);
+    cpu_id = get_cpu_id(cpu);
     if ( cpu_id == -1 )
     {
         printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu);
index 5402ba1f50779b33a8dff8086031e09cda2a5ae2..7ad75e29fc42679a54c29372a4f9d4e282c6518f 100644 (file)
@@ -6,7 +6,7 @@
 
 #define XEN_PX_INIT 0x80000000
 
-int get_cpu_id(u8);
+int get_cpu_id(u32);
 int powernow_cpufreq_init(void);
 unsigned int powernow_register_driver(void);
 unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);